home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programmer's Power Pack
/
Delphi Volume 1.iso
/
e_to_l
/
fbuilder
/
delphi
/
demos
/
vendorfm.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-09-15
|
3KB
|
128 lines
{* FormulaBuilder Demo *}
{* Copyright 1995 Clayton Collie *}
{* All Rights Reserved *}
{* *}
{* First form of a Database Expression demo *}
unit Vendorfm;
interface
uses
fbCalc,FBComp,FBDBComp,fbmisc,
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
StdCtrls, Forms, DBCtrls, DB, DBGrids, Buttons, DBTables, Grids, Mask,
ExtCtrls;
type
TVendorfrm = class(TForm)
ScrollBox: TScrollBox;
Label1: TLabel;
EditVendorNo: TDBEdit;
Label2: TLabel;
EditVendorName: TDBEdit;
Label3: TLabel;
EditAddress: TDBEdit;
Label4: TLabel;
EditAddress2: TDBEdit;
Label5: TLabel;
EditCity: TDBEdit;
Label6: TLabel;
EditState: TDBEdit;
Label7: TLabel;
EditZip: TDBEdit;
Label8: TLabel;
EditCountry: TDBEdit;
Label9: TLabel;
EditPhone: TDBEdit;
Label10: TLabel;
EditFAX: TDBEdit;
Label11: TLabel;
EditPreferred: TDBEdit;
DBGrid1: TDBGrid;
DBNavigator: TDBNavigator;
Panel1: TPanel;
DataSource1: TDataSource;
Panel2: TPanel;
Panel3: TPanel;
Table1: TTable;
Table2: TTable;
DataSource2: TDataSource;
ResultPanel: TPanel;
Label12: TLabel;
Table2PartNo: TFloatField;
Table2VendorNo: TFloatField;
Table2Description: TStringField;
Table2OnHand: TFloatField;
Table2OnOrder: TFloatField;
Table2Cost: TCurrencyField;
Table2ListPrice: TCurrencyField;
Table1VendorNo: TFloatField;
Table1VendorName: TStringField;
Table1Address1: TStringField;
Table1Address2: TStringField;
Table1City: TStringField;
Table1State: TStringField;
Table1Zip: TStringField;
Table1Country: TStringField;
Table1Phone: TStringField;
Table1FAX: TStringField;
Table1Preferred: TBooleanField;
Table1Dummy: TStringField;
Label13: TLabel;
ResultEdit: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Table1CalcFields(DataSet: TDataset);
private
fCreated : boolean;
fExpression : TDBExpression;
Procedure UpdateResults;
public
{ public declarations }
end;
var
Vendorfrm: TVendorfrm;
implementation
uses dbexprfm;
{$R *.DFM}
procedure TVendorfrm.FormCreate(Sender: TObject);
begin
Table1.Open;
Table2.Open;
Fexpression := TDBExpression.Create(Self);
FExpression.Database := Table1.Database;
fCreated := True;
end;
Procedure TVendorFrm.UpdateResults;
var s : string;
begin
if Assigned(FExpression) and (not FExpression.isNull) then
begin
s := FExpression.AsString;
ResultEdit.Text := s;
end;
end;
procedure TVendorfrm.BitBtn1Click(Sender: TObject);
begin
if BuildDBExpression('Database Expression Demo',fExpression) then
begin
UpdateResults;
end;
end;
procedure TVendorfrm.Table1CalcFields(DataSet: TDataset);
begin
UpdateResults;
end;
end.